<?php ob_start(); ?>
<!DOCTYPE html>
<html>
	<head>
		<title>Tyvo Ranger</title>
		<link rel="stylesheet" type="text/css" title="theme1" href="css/theme1.css"/>
		<script type="text/javascript" src="ajax_like.js"></script>
		<?php
			include 'application/pop_script.php';
		?>
	</head>
<body>
	<?php
			include 'views/header_view.php';
	?>
	<div class="primaryContent">
		<div id="container" class="container">
			<!-- sorting bar -->
			<div class="sorting-bar">
				<ul class="content-type">
					<?php
						echo $tab;
					?>
				</ul>
			</div>
			<div id="content">
			<?php for($i=0;$i<3;$i++) { ?>
				<!-- post -->
				<div class="portofolio">
					<!-- content -->
					<a class="imgcontainer" href="index.php?page=content&p=1&id=<?php echo $post[$i]['ID_post'] ?>">
						<?php if ($post[$i]['wujud']==2) { ?>
						<img class="bestcontent" height="300" width="400" src="<?php echo $post[$i]['link'] ?>">
						<?php } else if ($post[$i]['wujud']==0) { ?>
							<span class="link">
								<span class="url"><?php echo $post[$i]['link']?></span><br/>
								<span class="desc"><?php echo $post[$i]['deskripsi'] ?></span>
							</span>
						<?php } else if ($post[$i]['wujud']==1) { 
							$url = $post[$i]['link'];
							preg_match('/[\\?\\&]v=([^\\?\\&]+)/',$url,$matches);
							$id = $matches[1];
							$width = '400';
							$height = '300';
							echo '<object width="' . $width . '" height="' . $height . '"><param name="movie" value="http://www.youtube.com/v/' . $id . '&amp;hl=en_US&amp;fs=1?rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/' . $id . '&amp;hl=en_US&amp;fs=1?rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="' . $width . '" height="' . $height . '"></embed></object>';						
						} ?>
					</a>
					<span class="info">
						<!-- title -->
						<br/>
						<a class="title" href="index.php?page=content&id=<?php echo $post[$i]['ID_post'] ?>"><?php echo $post[$i]['judul'] ?></a>
						<!-- name -->
						<br/>
						<span class="name">
							<a href="?page=profile&user=username" id="name-<?php echo $post[$i]['ID_post'] ?>"><?php echo $post[$i]['username']; ?>
							</a>
						</span>

						<span id="space">_</span>
						<!-- time -->
						<span class="waktu">
							<span id="time-<?php echo $post[$i]['ID_post'] ?>"><?php echo time() - $post[$i]['time'] ?>
							</span>
						</span>
						<!-- like-dislike -->
						<br/>
						<span class="likecount">
							<img class="mark" src="theme/like-mark.png">
							<div id="likes-<?php echo $post[$i]['ID_post'] ?>"><?php echo $post[$i]['total_like'] ?></div>
						</span>
						<!-- nComment -->
						<span class="ncomment">
							<img class="mark" src="theme/comment-mark.png">
							<span id="ncomment-<?php echo $post[$i]['ID_post'] ?>" ><?php echo $post[$i]['jml_komentar'] ?></span>
						</span>
						<br/><br/>
						<button id="but_like<?php echo $post[$i]['ID_post'] ?>" class="but_like" onclick="updateLike(<?php echo $post[$i]['ID_post'] ?>);">Like</button>
						<button id="but_dislike<?php echo $post[$i]['ID_post'] ?>" class="but_dislike" onclick="updateDislike(<?php echo $post[$i]['ID_post'] ?>);">Dislike</button>
					</span>
				</div>
				<br/>
				<?php if ($i<3-1) echo '<hr class="line">'?>
			<?php } ?>
			</div>
		</div>
	</div>
</body>
</html>
<?php ob_flush(); ?>